<?php
//=======================================
// !! GYSN RELEASE - DO NOT REMOVE  !!
// !! DeZend by: syairx             !!
// !! Debug by: syairx & str/GYSN   !!
// !! Nullify by: str/GYSN & syairx !!
// !! GYSN RELEASE - DO NOT REMOVE  !!
//=======================================

function create_encoded_invoiceid( $invid )
{
    return tcrypt( "goaway", $invid, "en" );
}

function create_encoded_password( $pass, $encoded = "" )
{
    if ( $encoded == "1" )
    {
        return md5( md5( $pass."notmb" ) );
    }
    return md5( $pass."notmb" );
}

if ( !function_exists( "tcrypt" ) )
{
    function tcrypt( $pwd, $data, $case )
    {
        if ( $case == "de" )
        {
            $data = urldecode( $data );
        }
        $key[] = "";
        $box[] = "";
        $temp_swap = "";
        $pwd_length = 0;
        $pwd_length = strlen( $pwd );
        $i = 0;
        for ( ; $i < 255; ++$i )
        {
            $key[$i] = ord( substr( $pwd, $i % $pwd_length + 1, 1 ) );
            $box[$i] = $i;
        }
        $x = 0;
        $i = 0;
        for ( ; $i < 255; ++$i )
        {
            $x = ( $x + $box[$i] + $key[$i] ) % 256;
            $temp_swap = $box[$i];
            $box[$i] = $box[$x];
            $box[$x] = $temp_swap;
        }
        $temp = "";
        $k = "";
        $cipherby = "";
        $cipher = "";
        $a = 0;
        $j = 0;
        $i = 0;
        for ( ; $i < strlen( $data ); ++$i )
        {
            $a = ( $a + 1 ) % 256;
            $j = ( $j + $box[$a] ) % 256;
            $temp = $box[$a];
            $box[$a] = $box[$j];
            $box[$j] = $temp;
            $k = $box[( $box[$a] + $box[$j] ) % 256];
            $cipherby = ord( substr( $data, $i, 1 ) ) ^ $k;
            $cipher .= chr( $cipherby );
        }
        if ( $case == "de" )
        {
            $cipher = urldecode( urlencode( $cipher ) );
            return $cipher;
        }
        $cipher = urlencode( $cipher );
        return $cipher;
    }
}
?>